from django.shortcuts import render
from django.views import generic

from main.models import Author

from . import utils


class AuthorDisplay(generic.View):

    def get(self, request, name_slug):
        return utils.get_information_about_author(request, name_slug)



class AuthorActions(generic.View):

    def get(self, request, action):
        return utils.get_information_about_authors(request, action)


class DisplayListAuthors(generic.View):

    def get(self, request):
        authors = Author.objects.all()
        context = {'block': 'authors',
                   'authors': authors}
        return render(request, 'main/authors.html', context)
